#!/usr/bin/python
# -*- coding: UTF-8 -*-
# author:heqiang
import time

from tornado.httpserver import HTTPServer
from tornado.wsgi import WSGIContainer
from webService.app import app  # view manager
from tornado.ioloop import IOLoop
from threading import Thread
import requests

port = 80
s = HTTPServer(WSGIContainer(app))
print("listening port : 80 .....")
s.listen(port)  # 监听 80 端口


def check_demo():
    while True:
        time.sleep(300)
        requests.get(url="http://127.0.0.1:%d/ordercheck" % (port))


t = Thread(target=check_demo)
t.setDaemon(True)
t.start()
IOLoop.current().start()

"""
        location / {
            proxy_pass http://localhost:5000;    
            
            
        }
        #关键一点就是这里，意思是所有对http://www.abc.com:80的访问都会重定向到本机的５０００端口上
"""
